package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.SeckillMapper;
import com.ruoyi.system.domain.Seckill;
import com.ruoyi.system.service.ISeckillService;

/**
 * 秒杀Service业务层处理
 * 
 * @author ruoyi
 * @date 2022-12-26
 */
@Service
public class SeckillServiceImpl implements ISeckillService 
{
    @Autowired
    private SeckillMapper seckillMapper;

    /**
     * 查询秒杀
     * 
     * @param sid 秒杀主键
     * @return 秒杀
     */
    @Override
    public Seckill selectSeckillBySid(Long sid)
    {
        return seckillMapper.selectSeckillBySid(sid);
    }

    /**
     * 查询秒杀列表
     * 
     * @param seckill 秒杀
     * @return 秒杀
     */
    @Override
    public List<Seckill> selectSeckillList(Seckill seckill)
    {
        return seckillMapper.selectSeckillList(seckill);
    }

    /**
     * 新增秒杀
     * 
     * @param seckill 秒杀
     * @return 结果
     */
    @Override
    public int insertSeckill(Seckill seckill)
    {
        seckill.setCreateTime(DateUtils.getNowDate());
        return seckillMapper.insertSeckill(seckill);
    }

    /**
     * 修改秒杀
     * 
     * @param seckill 秒杀
     * @return 结果
     */
    @Override
    public int updateSeckill(Seckill seckill)
    {
        return seckillMapper.updateSeckill(seckill);
    }

    /**
     * 批量删除秒杀
     * 
     * @param sids 需要删除的秒杀主键
     * @return 结果
     */
    @Override
    public int deleteSeckillBySids(Long[] sids)
    {
        return seckillMapper.deleteSeckillBySids(sids);
    }

    /**
     * 删除秒杀信息
     * 
     * @param sid 秒杀主键
     * @return 结果
     */
    @Override
    public int deleteSeckillBySid(Long sid)
    {
        return seckillMapper.deleteSeckillBySid(sid);
    }
}
